<%-- 
    Document   : logoutaction
    Created on : Dec 8, 2009, 3:36:53 PM
    Author     : gabriel
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="br.com.zumbits.avd.web.client.Conn" %>
<%@page import="br.com.zumbits.avd.web.client.Logoff" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Another Disk Virtual</title>
        <%
            //verifica se a conexão está na sessão
            Conn c = (Conn) session.getAttribute("conn");
            
            if (c != null) {
                String session_id = session.getAttribute("session_id").toString();
                String username = session.getAttribute("username").toString();
                Logoff logoff = c.logoff(session_id, username);

                if (logoff.getStatus().equals(Conn.LOGOFF_SUCCESS)) {
                    response.sendRedirect("index.jsp");
                    session.removeAttribute("username");
                    session.removeAttribute("session_id");
                }
            }
        %>
    </head>
    <body>
        <h1>Ops... ocorreu algum err =p</h1>
    </body>
</html>
